Handle the case where you type /blah/nonexistent in SELECT_FOLDER mode
authorFederico Mena Quintero <federico@novell.com>
Tue, 5 Oct 2010 19:41:51 +0000 (14:41 -0500)
committerFederico Mena Quintero <federico@novell.com>
Tue, 5 Oct 2010 20:35:31 +0000 (15:35 -0500)
Previously name_entry_get_parent_info_cb() would fail as it doesn't handle SELECT_FOLDER.
Now we just make that function act the same as for CREATE_FOLDER mode.  In either
case, if you type "/blah/nonexistent" and hit Enter, you want a folder
with that name to be created (under the already-existing /blah).

Signed-off-by: Federico Mena Quintero <federico@novell.com>
gtk/gtkfilechooserdefault.c

index 9fceb8aa70531b30309167c93130935db4ffde8d..c0aad3e7f72d97025df6dfff59c5845062e47d51 100644 (file)
@@ -8185,10 +8185,15 @@ name_entry_get_parent_info_cb (GCancellable *cancellable,
          else
            g_signal_emit_by_name (data->impl, "response-requested");
        }
-      else if (data->impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+      else if (data->impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
+              || data->impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
         {
          GError *error = NULL;
 
+         /* In both cases (SELECT_FOLDER and CREATE_FOLDER), if you type
+          * "/blah/nonexistent" you *will* want a folder created.
+          */
+
          set_busy_cursor (data->impl, TRUE);
          g_file_make_directory (data->file, NULL, &error);
          set_busy_cursor (data->impl, FALSE);